package com.CMC.yhdeng;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import com.CMC.yhdeng.ExamUnitContent.ExamType;
import com.CMC.yhdeng.QuizContent.QCState;

public class Sound2wordActivity extends QuizBaseActivity {

	ImageView ivSound;
//	public ChapterContent exams;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setCView();
		findViews();
		filterQuiz(ExamType.SOUND2WORD);
	}

	protected void setCView()
	{
		setContentView(R.layout.activity_sound2word);
	}
	
	@Override
	protected void findViews()
	{
		super.findViews();
		
		setQuizVisiblity(View.INVISIBLE);
		ivAnsMic.setVisibility(View.INVISIBLE);
		findViewById(R.id.imSpeaker).setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
//				QuizContent qc=quizList.next();
//				if(qc!=null)
				playSound(curQuiz.filename);
				
//				txtTimeHint.setText("abc");
				
			}
		});
	}
//	@Override
//	public boolean onCreateOptionsMenu(Menu menu) {
//		// Inflate the menu; this adds items to the action bar if it is present.
//		getMenuInflater().inflate(R.menu.sound2word, menu);
//		return true;
//	}

	@Override
	protected void tick() {
		// TODO Auto-generated method stub
		
	}

//	@Override
//	protected void timeUp() {
//		super.timeUp();
//		
//	}

	
//	@Override
//	protected void onStart() {
//		super.onStart();
//		
//	}
//
//	@Override
//	protected void onStop() {
//		super.onStop();
//	}
	

//	@Override
//	protected void updateScenseAfterQuizInfoDownloaded() {
//		super.updateScenseAfterQuizInfoDownloaded();
//		playSound(curQuiz.filename);
//		
//	}

	@Override
	protected void answerChecked() {
		super.answerChecked();
//		etAnswer.setText("");
		if (curQuiz == null)  endQuiz();
	}

	@Override
	protected void clickYes() {

		//check answer
		
		String sInputAns=(String)(etAnswer.getText().toString());
//		QuizContent qc= quizList.getCurrent();
		QuizContent qc=curQuiz;
		qc.answerState=qc.answer.compareTo(sInputAns)==0 ? QCState.CORRECT : QCState.WRONG;
		Boolean isAnsweredCorrect=qc.answerState==QCState.CORRECT;
		popupAnswerResultView(isAnsweredCorrect);
		
		super.clickYes();
	}

	
	
}
